
# 自定义的异常类
class MyException(Exception):

    def __init__(self, value):
        self.value = value

    def __str__(self):
        return "输入值{}错误，超出分数值100的范围".format(self.value)

class MyException1(MyException):
    def __init__(self, value):
        self.value = value

    def __str__(self):
        return "输入值{}错误，大于了100范围".format(self.value)


class MyException2(MyException):
    def __init__(self, value):
        self.value = value

    def __str__(self):
        return "输入值{}错误，小于了0范围".format(self.value)

value = -101
if value > 100:
    raise MyException1(value)
elif value < 0:
    raise MyException2(value)